package com.wyfan.scaffold.test;

import com.google.common.util.concurrent.ThreadFactoryBuilder;

import java.util.concurrent.PriorityBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

/**
 * 计算任务线程池
 * @author one
 */
public class CalPool {

    private static ThreadPoolExecutor pool;

    static {
        pool = new ThreadPoolExecutor(1,1,1, TimeUnit.SECONDS, new PriorityBlockingQueue<>(),new ThreadFactoryBuilder().setNameFormat("cal-task-%d").build());
    }

    public static void submit(CalTaskAbstract calTask) {
        pool.execute(calTask);
    }
}
